﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml.Data;

namespace BoriPeter.FitnessJournal8.Converters
{
    public class AddUnitConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            int intValue;
            if (value == null)
                return "-";
            if (int.TryParse(value.ToString(), out intValue))
            {
                if ((intValue == 0) || (value.ToString() == ""))
                    return "-";
            }
            return value.ToString() + " " + parameter.ToString();
        }

        public object ConvertBack(object value, Type targetType, object parameter, string language)
        {
            throw new NotImplementedException();
        }
    }
}
